<{capture name="header"}>
<style media="print">
div{font-size:14pt; }
</style>
<style media="screen">
div{font-size:12px ;}
</style>
<style>
.order-box{ height:auto; padding:10px 10px 0 10px; margin:5px 20px 0 20px; }
.order-box li{ padding:3px 0}
.order-tr{ font-weight:bold; border-bottom:1px solid #000;}
.table-border{ margin:10px 0; border-top:2px solid #333;border-bottom:2px solid #333}
.order-box td{ padding:3px 5px; vertical-align:top}
.order-font{ font-weight:bold; padding:0 5px; clear:both; height:25px; line-height:25px; margin:5px 0 25px 0}
</style>
<{/capture}>

<{ if $errIds }>
<div class="errormsg notice" id="errormsg">
    <div id="msg" class="msg">注意：本次打印数据中的一些单据有问题，这些数据将被忽略(详细内容见下面列表)！！！</div>
    <br>
    <{ foreach from=$errIds item=id }>
        <{$allItems[$id]['delivery_bn']}> &nbsp; : &nbsp; <{$errInfo[$id]}><br>
    <{ /foreach }>
</div>
<{ /if }>


<{if $err=='false'}>
<{foreach from=$items item=item}>
<div style="page-break-after: always; margin:0">
<div class="order-box " style="margin-top:0">
<table width="100%" cellpadding="0" cellspacing="0" border="0" >
<tr><td colspan="2" ><h3>销售发货单</h3></td></tr>
<tr><td width="71%" rowspan="4" valign="top" style="padding:5px 0"><{$item.delivery_bn|barcode}></td>
<td valign="middle" >发货单号：<span style="font-weight:bold"><{$item.delivery_bn}></span></td></tr>
<tr><td>制单人： <{$item.op_name}></td></tr>
<tr><td>电话号码：<{$item.consignee.telephone}>/<{$item.consignee.mobile}></td></tr>
<tr><td>会员名：<{$item.member_name}></td></tr>
<tr><td colspan="2">打印日期： <{$time}></td></tr>
<tr><td colspan="2">订单号：<{$item.order_bn}></td></tr>
<tr>
         <td >地址：<{$item.consignee.area|region}></td>
        </tr>
</table>
<table border="0" align="center" width="100%" cellpadding="0"  cellspacing="0"  class="table-border">
  <tr >
    <td><b>货号</b></td>
    <td><b>数量</b></td>
    <td><b>规格</b></td>
    <td><b>商品名称</b></td>
  </tr>
<{foreach from=$item.delivery_items item=i}>
<tr>
    <td ><{$i.bn}></td>
    <td><{$i.number}></td>
    <td><{$i.addon|default:'--'}></td>
    <td><{$i.name}></td>
</tr>
<{/foreach}>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-bottom:1px solid #666">
  <tr>
    <td align="right">销售发货单数量总计：<{$item.delivery_total_nums}>
    <{if $item.order_total_amount}>
     &nbsp;订单总金额:<{$item.order_total_amount}>
    <{/if}>
    </td>
    </tr>
</table>
<style>
    #aaa td{border:none;}
</style>
<h3 style="padding:0 5px; height:28px; line-height:28px;">收货人信息</h3>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
          <td width="71%" rowspan="4">订单备注：
          <{foreach name="m1" from=$item._mark_text key=key item=item1}>
              <br><{$key}>:
              <{foreach from=$item1 item=it}>
                  <br>&nbsp;&nbsp;&nbsp;&nbsp;<b><{$it.op_content}></b> <{$it.op_time}> by <{$it.op_name}>
              <{/foreach}>
          <{/foreach}>
          <br /><br />订单附言：
          <{foreach name="m1" from=$item._mark key=key item=item1}>
              <br><{$key}>:
              <{foreach from=$item1 item=it}>
                  <br>&nbsp;&nbsp;&nbsp;&nbsp;<b><{$it.op_content}></b> <{$it.op_time}> by <{$it.op_name}>
              <{/foreach}>
          <{/foreach}>
          </td>
          <td >收货人：<{$item.consignee.name}></td>
        </tr>
        <tr>
          <td >手机：<{$item.consignee.mobile}></td>
        </tr>
        <tr>
          <td>邮编：<{$item.consignee.zip}></td>
        </tr>
        <tr>
         <td >地址：<{$item.consignee.area|region}></td>
        </tr>

   <tr>
      <td align="left" class="order-font">批次号：<{$idents[$item['delivery_id']]}></td>
    <td  style="text-align:right; font-weight:bold" class="order-tr">Powered by QinqinBaby.com</td>
    </tr>
  
</table>
<div style="clear:both"></div>
</div>
</div>
<{/foreach}>
<{/if}>
<script>
var err = <{$err}>;
if (err==true){
	new Dialog(new Element("div.tableform",{html:'<div class="division">部分发货单已被合并或者拆分</div><div class="table-action"><{button label="关闭" onclick="re_finder();"}></div>'}),{
        title:'错误',
        width:230,
        height:130,
        modal:true,
        resizeable:false});
}

function re_finder(){
    opener.finderGroup['<{$env.get.finder_id}>'].unselectAll();
	opener.finderGroup['<{$env.get.finder_id}>'].refresh.delay(400,opener.finderGroup['<{$env.get.finder_id}>']);
    window.close();
}

function changePrint()
{
    new Dialog(new Element("div.tableform",{html:'<div id="pause" class="division">正在提交数据<{img app="desktop" src="loading.gif"}></div><div class="table-action"><{button label="关闭" onclick="re_finder();"}></div>'}),{
        title:'提示',
        width:230,
        height:130,
        modal:true,
        resizeable:false}
    );
    var printname= $('printname').value;
    new Request({url:'index.php?app=ome&ctl=admin_receipts_print&act=setPrintStatus',method:'post',data:'type=stock_dly&str='+printname,
        onSuccess:function(json){
          if (json == 'true'){
              $('pause').getParent('.dialog').retrieve('instance').close();
              window.print();
          }else {
              $('pause').set('text',json);
          }
        }
    }).send();
}

</script>

